home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -seriously_amiga- / misc / ced_html / html / html_formular.ced < prev    next >
Text File  |  1999-01-25  |  5KB  |  199 lines

  1. /*
  2. ** html_formular.ced
  3. **
  4. ** $VER: html_formular.ced 1.6 (01.05.1999)
  5. **
  6. ** Arexx script for HTML v3.2 formular structure
  7. **
  8. ** This script works with CygnusEd Professional v4.2
  9. **
  10. ** Copyright © Eric BELLE
  11. */
  12.  
  13. /*
  14. **------------------------------------------------------------------------------
  15. **    Initialisation
  16. **------------------------------------------------------------------------------
  17. */
  18.  
  19. OPTIONS RESULTS                            /* Tell CygnusEd to return results. */
  20. NL = '0A'X                                    /* Alias for new line. */
  21. KRETURN = RAWKEY 68                    /* Shortcut to the return key. */
  22. KTAB = RAWKEY 66                        /* Shortcut to the tab key. */
  23. STATUS TABSARESPACES                /* Return TAB mode ("tab" or "space"). */
  24. IF RESULT = 1                                /* Test the TAB mode. */
  25. THEN "TABS = SPACES"                /* Switch TAB mode from "space" to "tab". */
  26. ELSE NOP                                        /* No operation. */
  27. TAB SIZE 1                                    /* Set TAB size proportional to 2 spaces. */
  28.  
  29. /*
  30. **------------------------------------------------------------------------------
  31. **    Formular destination
  32. **------------------------------------------------------------------------------
  33. */
  34.  
  35. FormularDestination="no"
  36. DO WHILE (FormularDestination="no")
  37.         OKAY2 "Formular destination:                    "    ||    NL    ||,
  38.                     "~~~~~~~~~~~~~~~~~~~~                     "    ||    NL    ||,
  39.                     "  (0) - local        |  (2) - universal  "    ||    NL    ||,
  40.                     "  (1) - absolute     |  (3) - e-mail     "
  41.         
  42.     IF (RESULT=0)
  43.     THEN EXIT 0
  44.     ELSE FormularDestination="ok"
  45.  
  46.     GETNUMBER 0 '"Destination mode?"' 0 3
  47.     DestinationMode = RESULT
  48.  
  49.     IF (destinationMode=" ")
  50.     THEN FormularDestination = "no"
  51.     ELSE NOP
  52. END
  53.  
  54. /*
  55. **------------------------------------------------------------------------------
  56. **    Html formular marks
  57. **------------------------------------------------------------------------------
  58. */
  59.  
  60. SELECT
  61.     WHEN (DestinationMode=0) THEN DO
  62.         GETSTRING "Script" '"Destination script name with its relative path?"'
  63.         DestinationScript = RESULT
  64.  
  65.         IF (DestinationScript=" " | DestinationScript="RESULT")
  66.         THEN EXIT 0
  67.         ELSE NOP
  68.  
  69.         DestinationString = ' ACTION="' || DestinationScript || '"'
  70.     END
  71.     WHEN (DestinationMode=1) THEN DO
  72.         STATUS DIRNAME
  73.         DestinationDir = RESULT || "/"
  74.  
  75.         GETFILENAME DestinationDir '"Select script"'
  76.         DestinationScript = RESULT
  77.  
  78.         IF (DestinationScript=" " | DestinationScript="RESULT")
  79.         THEN EXIT 0
  80.         ELSE NOP
  81.  
  82.         DestinationString = ' ACTION="http://localhost/' || DestinationScript || '"'
  83.     END
  84.     WHEN (DestinationMode=2) THEN DO
  85.         GETSTRING "Script" '"Destination script name with its universal path?"'
  86.         DestinationScript = RESULT
  87.  
  88.         IF (DestinationScript=" " | DestinationScript="RESULT")
  89.         THEN EXIT 0
  90.         ELSE NOP
  91.  
  92.         DestinationString = ' ACTION="http://' || DestinationScript || '"'
  93.     END
  94.     WHEN (DestinationMode=3) THEN DO
  95.         GETSTRING "e-mail" '"Electronic address?"'
  96.         DestinationScript = RESULT
  97.  
  98.         IF (DestinationScript=" " | DestinationScript="RESULT")
  99.         THEN EXIT 0
  100.         ELSE NOP
  101.  
  102.         DestinationString = ' ACTION="mailto:' || DestinationScript || '"'
  103.     END
  104.     OTHERWISE NOP
  105. END
  106.  
  107. /*
  108. **------------------------------------------------------------------------------
  109. **    Sending method
  110. **------------------------------------------------------------------------------
  111. */
  112.  
  113. SendingMethod = "q"
  114. DO WHILE ~(SendingMethod="g" | SendingMethod="p",
  115.                     | SendingMethod=" " | SendingMethod="RESULT")
  116.     GETSTRING "g" '"Sending method: (g)et, (p)ost?"'
  117.     SendingMethod = RESULT
  118. END
  119.  
  120. IF (SendingMethod="RESULT" | SendingMethod=" ")
  121. THEN EXIT 0
  122. ELSE NOP
  123.  
  124. /*
  125. **------------------------------------------------------------------------------
  126. **    Html sending marks
  127. **------------------------------------------------------------------------------
  128. */
  129.  
  130. SELECT
  131.     WHEN (SendingMethod="g") THEN SendingString = " METHOD=GET"
  132.     WHEN (SendingMethod="p") THEN SendingString = " METHOD=POST"
  133.     OTHERWISE NOP
  134. END
  135.  
  136. OpenString = "<FORM" || DestinationString || SendingString || ">"
  137. CloseString = "</FORM>"
  138.  
  139. /*
  140. **------------------------------------------------------------------------------
  141. **    Buttons to reset end validate formular
  142. **------------------------------------------------------------------------------
  143. */
  144.  
  145. GETSTRING "y" '"Buttons to reset and validate the formular: (y)es, (n)o?"'
  146. Buttons = RESULT
  147.  
  148. SELECT
  149.     WHEN (Buttons="RESULT") THEN EXIT 0
  150.     WHEN (Buttons=" ") THEN EXIT 0
  151.     WHEN (Buttons="y") THEN DO
  152.         GETSTRING "Send" '"Button text to validate the formular?"'
  153.         ValidButtonText = RESULT
  154.  
  155.         IF (ValidButtonText="RESULT" | ValidButtonText=" ")
  156.         THEN EXIT 0
  157.         ELSE NOP
  158.         
  159.         ValidButtonString = '<INPUT TYPE=SUBMIT VALUE="' || ValidButtonText || '">'
  160.  
  161.         GETSTRING "Reset" '"Button text to reset all formular inputs?"'
  162.         ResetButtonText = RESULT
  163.  
  164.         IF (ResetButtonText="RESULT" | ResetButtonText=" ")
  165.         THEN EXIT 0
  166.         ELSE NOP
  167.         
  168.         ResetButtonString = '<INPUT TYPE=RESET VALUE="' || ResetButtonText || '">'
  169.     END
  170.     OTHERWISE NOP
  171. END
  172.  
  173. /*
  174. **------------------------------------------------------------------------------
  175. **    Html formular stucture
  176. **------------------------------------------------------------------------------
  177. */
  178.  
  179. TEXT OpenString ; "AUTO-INDENT" ; KTAB
  180. TEXT "Should be modified - Formular" ; "AUTO-INDENT"
  181. IF (Buttons="y")
  182. THEN DO
  183.     "AUTO-INDENT"
  184.     TEXT ValidButtonString
  185.     "AUTO-INDENT"
  186.     TEXT ResetButtonString
  187.     "AUTO-INDENT"
  188. END
  189. ELSE NOP
  190. BACKTAB ; TEXT CloseString
  191.  
  192. /*
  193. **------------------------------------------------------------------------------
  194. **    End of html_formular.ced Arexx script
  195. **------------------------------------------------------------------------------
  196. */
  197.  
  198. EXIT 0
  199.